package com.ozo.cloud.common.file.service;

import com.ozo.cloud.common.file.strategy.FileStrategy;
import lombok.RequiredArgsConstructor;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * 文件服务实现类
 *
 * @author qiangesoft
 * @date 2024-05-13
 */
@RequiredArgsConstructor
public class FileTemplateImpl implements FileTemplate {

    private final FileStrategy fileStrategy;

    @Override
    public void createCatalog(String catalog) throws Exception {
        fileStrategy.createCatalog(catalog);
    }

    @Override
    public List<String> listCatalogs() throws Exception {
        return fileStrategy.listCatalogs();
    }

    @Override
    public void removeCatalog(String catalog) throws Exception {
        fileStrategy.removeCatalog(catalog);
    }

    @Override
    public String uploadFile(String catalog, MultipartFile file) throws Exception {
        return fileStrategy.uploadFile(catalog, file);
    }

    @Override
    public void removeFile(String catalog, String fileName) throws Exception {
        fileStrategy.removeFile(catalog, fileName);
    }

    @Override
    public void removeFiles(String catalog, List<String> fileNames) throws Exception {
        fileStrategy.removeFiles(catalog, fileNames);
    }

}
